﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PCR.Base;
using PCR.Logic;

namespace PCR
{
    public partial class FormLogin : DevComponents.DotNetBar.Office2007Form
    {
        public FormLogin()
        {
            InitializeComponent();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            string username = this.textUsername.Text;
            string password = this.textPassword.Text;

            //if (!PCRXMLConfig.Instance.ValidateUser(username, password))
            if (!PCRRoot.Instance.PrivilegeManager.ValidateUser(username, password))
            {
                MessageBox.Show("用户名或密码错误，请重新输入", "错误", 
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.textUsername.Focus();
                this.textUsername.SelectAll();

                return;
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {

        }

        private void FormLogin_Load(object sender, EventArgs e)
        {
        }
    }
}
